--- 模块功能：短信功能测试.
-- @author openLuat
-- @module cmdcontrol
-- @license MIT
-- @copyright openLuat
-- @release 2018.03.27

module(...,package.seeall)

require"myupdate"

local slen,sbyte,ssub,sgsub,schar,srep,smatch,sgmatch = string.len,string.byte,string.sub,string.gsub,string.char,string.rep,string.match,string.gmatch

local function cbFnc(downloadResult)
	if downloadResult then
		sys.restart("myUpdate.downloadResult="..tostring(downloadResult))
	end
end
function updateFwd(url)
	-- update.request(cbFnc,"wibim.vicp.net:8086/api/site/firmware_upgrade")
	eUrl = "phone="..protoair.getPhoneEx()
	log.error("--zbb--eUrl:",eUrl)
    myupdate.request(cbFnc,url,nil,nil,eUrl)
end

function recvCmd(cmd)
	local cmd,v2 = smatch(cmd,"%*(.+)%,(.+)#")

	log.error("--zbb--recvCmd2:",cmd,v2)
	--if not v1 or not v2 then return string.toHex("FFFFFFFFFF") end
	if cmd == "update" then
		updateFwd(v2)
	end
end
-- recvCmd("*update,wibim.vicp.net/api/firmware_upgrade#")
